<template>
  <div class="stats-cards">
    <div class="stat-card pending" @click="$emit('tabChange', 'pending')">
      <div class="stat-number">{{ stats.pending }}</div>
      <div class="stat-label">待接单</div>
    </div>
    <div class="stat-card processing" @click="$emit('tabChange', 'processing')">
      <div class="stat-number">{{ stats.processing }}</div>
      <div class="stat-label">处理中</div>
    </div>
    <div class="stat-card completed" @click="$emit('tabChange', 'completed')">
      <div class="stat-number">{{ stats.completed }}</div>
      <div class="stat-label">已完成</div>
    </div>
  </div>
</template>

<script setup lang="ts">
interface Stats {
  pending: number
  processing: number
  completed: number
}

defineProps<{
  stats: Stats
}>()

defineEmits<{
  tabChange: [tab: string]
}>()
</script>

<style scoped>
.stats-cards {
  display: flex;
  padding: 16px;
  gap: 12px;
}

.stat-card {
  flex: 1;
  background: white;
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: transform 0.2s;
}

.stat-card:active {
  transform: scale(0.95);
}

.stat-number {
  font-size: 24px;
  font-weight: bold;
  margin-bottom: 4px;
}

.stat-card.pending .stat-number {
  color: #e6a23c;
}

.stat-card.processing .stat-number {
  color: #409eff;
}

.stat-card.completed .stat-number {
  color: #67c23a;
}

.stat-label {
  font-size: 12px;
  color: #666;
}

/* 响应式设计 */
@media (max-width: 480px) {
  .stats-cards {
    padding: 12px;
    gap: 8px;
  }
  
  .stat-card {
    padding: 12px;
  }
  
  .stat-number {
    font-size: 20px;
  }
}
</style>